import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import "."  // 添加当前目录导入

Window {
    width: 1000
    height: 800
    visible: true
    title: "TableView 示例集合"

    Rectangle {
        anchors.fill: parent
        color: "#f5f5f5"

        ColumnLayout {
            anchors.fill: parent
            anchors.margins: 20
            spacing: 20

            Text {
                Layout.fillWidth: true
                text: "TableView 示例集合"
                font {
                    pixelSize: 28
                    bold: true
                }
                color: "#1976D2"
                horizontalAlignment: Text.AlignHCenter
            }

            GridLayout {
                Layout.fillWidth: true
                Layout.fillHeight: true
                columns: 2
                rowSpacing: 20
                columnSpacing: 20

                // 基础表格示例
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "white"
                    radius: 4
                    layer.enabled: true
                    layer.effect: DropShadow {
                        transparentBorder: true
                        horizontalOffset: 0
                        verticalOffset: 2
                        radius: 8.0
                        samples: 17
                        color: "#20000000"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        anchors.margins: 10

                        Text {
                            Layout.fillWidth: true
                            text: "基础表格"
                            font.pixelSize: 16
                            font.bold: true
                            color: "#333333"
                            horizontalAlignment: Text.AlignHCenter
                        }

                        BasicTableView {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                        }
                    }
                }

                // 自定义样式表格示例
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "white"
                    radius: 4
                    layer.enabled: true
                    layer.effect: DropShadow {
                        transparentBorder: true
                        horizontalOffset: 0
                        verticalOffset: 2
                        radius: 8.0
                        samples: 17
                        color: "#20000000"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        anchors.margins: 10

                        Text {
                            Layout.fillWidth: true
                            text: "自定义样式表格"
                            font.pixelSize: 16
                            font.bold: true
                            color: "#333333"
                            horizontalAlignment: Text.AlignHCenter
                        }

                        CustomTableView {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                        }
                    }
                }

                // 可排序表格示例
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "white"
                    radius: 4
                    layer.enabled: true
                    layer.effect: DropShadow {
                        transparentBorder: true
                        horizontalOffset: 0
                        verticalOffset: 2
                        radius: 8.0
                        samples: 17
                        color: "#20000000"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        anchors.margins: 10

                        Text {
                            Layout.fillWidth: true
                            text: "可排序表格"
                            font.pixelSize: 16
                            font.bold: true
                            color: "#333333"
                            horizontalAlignment: Text.AlignHCenter
                        }

                        SortableTableView {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                        }
                    }
                }

                // 可编辑表格示例
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "white"
                    radius: 4
                    layer.enabled: true
                    layer.effect: DropShadow {
                        transparentBorder: true
                        horizontalOffset: 0
                        verticalOffset: 2
                        radius: 8.0
                        samples: 17
                        color: "#20000000"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        anchors.margins: 10

                        Text {
                            Layout.fillWidth: true
                            text: "可编辑表格"
                            font.pixelSize: 16
                            font.bold: true
                            color: "#333333"
                            horizontalAlignment: Text.AlignHCenter
                        }

                        EditableTableView {
                            Layout.fillWidth: true
                            Layout.fillHeight: true
                        }
                    }
                }
            }
        }
    }
}
